#ifndef __DV_WIN32_H__
#define __DV_WIN32_H__

#include "IDevice.h"
#include <Windows.h>

/// esCreateWindow flag - RGB color buffer
#define ES_WINDOW_RGB           0
/// esCreateWindow flag - ALPHA color buffer
#define ES_WINDOW_ALPHA         1 
/// esCreateWindow flag - depth buffer
#define ES_WINDOW_DEPTH         2 
/// esCreateWindow flag - stencil buffer
#define ES_WINDOW_STENCIL       4
/// esCreateWindow flat - multi-sample buffer
#define ES_WINDOW_MULTISAMPLE   8

class DeviceWin32 : public IDevice
{
private:
	const char* m_wcsTitle;
	_utInt32 m_iFlags;
	_utInt32 m_iWidth;
	_utInt32 m_iHeight;

	EGLNativeWindowType m_eglHWND;
	EGLDisplay m_eglDisplay;
	EGLContext m_eglContext;
	EGLSurface m_eglSurface;

	void(*m_KeyFunc)(unsigned char, bool);
	static DeviceWin32* m_InstanceTemp;
private:
	EGLBoolean w32CreateESContext(EGLint[]);
	EGLBoolean w32CreateClientWindows();
	static LRESULT w32WindowsProc(HWND, UINT, WPARAM, LPARAM);
protected:
	void DestroyView();
public:
	virtual void RegisterUpdateFunc(void(*UpdateFunc)(float));
	virtual void RegisterDrawFunc(void(*DrawFunc)());
	virtual void RegisterKeyFunc(void(*KeyFunc)(unsigned char, bool));
	virtual void RegisterSelectedFunc(void(*SelectedFunc)());
	virtual void Run();

	EGLBoolean w32CreateWindows();
	DeviceWin32(_utInt32, _utInt32, char*, _utInt32);
	DeviceWin32() : DeviceWin32(800, 600, "NO NAME", 0){}
};

#endif